package gold.digger;

import gold.utils.InputUtil;

import java.util.Arrays;

/**
 * Created by fanzhenyu02 on 2020/6/27.
 * common problem solver template.
 */
public class LC453 {
    public long startExecuteTime = System.currentTimeMillis();


    class Solution {
        public int minMoves(int[] arr) {
            Arrays.sort(arr);
            int move = 0;
            for (int i = 1; i < arr.length; i++) {
                move += arr[i] - arr[0];
            }

            return move;
        }
    }

    public void run() {
        Solution solution = new Solution();
        int[] arr = InputUtil.toIntegerArray("1,1,2147483647");
        System.out.println(solution.minMoves(arr));
    }

    public static void main(String[] args) throws Exception {
        LC453 an = new LC453();
        an.run();

        System.out.println("\ncurrent solution total execute time: " + (System.currentTimeMillis() - an.startExecuteTime) + " ms.");
    }
}
